<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
function sortOrderByColumn(_orderFiled, _orderFlag, _form, _actionPath) {
	var orderFiled = "id";
	var orderFlag = "asc";
	if (_orderFiled != "id") {
		orderFiled = _orderFiled;
	}
	if (_orderFlag == "desc") {
		orderFlag = "asc";
	} else if (_orderFlag == "asc") {
		orderFlag = "desc";
	}
	with (_form) {
		if (_actionPath.indexOf("?") > 0) {
			action = _actionPath + "&orderField=" + orderFiled
					+ "&orderFlag=" + orderFlag;
		} else {
			action = _actionPath + "?orderField=" + orderFiled
					+ "&orderFlag=" + orderFlag;
		}
		submit();
	}
}
window.onload = function() {
	//getTabelHeight('addcontent','listFrm','navbar2')
	var _tab = document.getElementsByTagName('table');
	for (var i = 0; i < _tab.length; i++) {
		if (_tab[i].className == 'its _scrolling') {
			sortByColumnDisplay(_tab[i]);
		}
	}
};

function sortByColumnDisplay(_tab) {
	try {
		var _orderFlag = '${orderFlag}';
		var _orderFiled = '${orderField}';
		var _thTag = _tab.getElementsByTagName("th");
		var _thContentOld;
		var _thContent;
		var tmp;
		var strTmp1 = 'sortByColumn("';
		var strTmp2 = '")';

		for (var i = 0; i < _thTag.length; i++) {
			_thContentOld = _thTag[i].innerHTML;
			//alert(_thContentOld);
			if (_thContentOld.indexOf(strTmp1) > 0) {
				tmp = _thContentOld.substr(_thContentOld.indexOf(strTmp1)
						+ strTmp1.length);
				//alert(tmp);
				tmp = tmp.substr(0, tmp.indexOf(strTmp2));
				if (tmp == _orderFiled) {
					if (_orderFlag == 'asc') {
						_thContent = _thContentOld + '↑';
					} else if (_orderFlag == 'desc') {
						_thContent = _thContentOld + '↓';
					}
					document.getElementById(tmp).innerHTML = _thContent;
				}
			}
		}
	} catch (e) {
		alert(e);
	}
}


</script>